function ChessPiece()
{
    this.m_boardPos = new Point(0, 0);
    this.m_drawPos = new Point(0, 0);
    this.m_isActive = true;
    this.m_isSelected = false;
    this.m_isRedSide = false;
    this.m_selectedImage = new Image();
    this.m_imageChessPiece = new Image();
}

ChessPiece.prototype.constructor = function()
{

}

ChessPiece.prototype.SetImage = function(fileDir)
{
    this.m_imageChessPiece.src = fileDir;
}

ChessPiece.prototype.SetXPos = function(posX)
{
    this.m_drawPos.SetX(posX);
}

ChessPiece.prototype.GetXPos = function ()
{
    return this.m_drawPos.GetX();
}

ChessPiece.prototype.SetYPos = function (posY)
{
    this.m_drawPos.SetY(posY);
}

ChessPiece.prototype.GetYPos = function ()
{
    return this.m_drawPos.GetY();
}

ChessPiece.prototype.SetRow = function (inputRow)
{
    if (inputRow >= 0)
    {
        this.m_boardPos.SetY(inputRow);
    }
}

ChessPiece.prototype.GetRow = function ()
{
    return this.m_boardPos.GetY();
}

ChessPiece.prototype.SetCollumn = function (inputCol)
{
    if (inputCol >= 0)
    {
        this.m_boardPos.SetX(inputCol);
    }
}

ChessPiece.prototype.GetCollumn = function ()
{
    return this.m_boardPos.GetX();
}

ChessPiece.prototype.SetDeactive = function ()
{
    this.m_isActive = false;
}

ChessPiece.prototype.SetActive = function ()
{
    this.m_isActive = true;
}

ChessPiece.prototype.IsActive = function ()
{
    return this.m_isActive;
}

ChessPiece.prototype.Update = function ()
{
    var cellDistance = ConstValue.padding() + ConstValue.cellHeightWidth();
    this.m_drawPos.SetX(this.m_boardPos.GetX() * cellDistance + ConstValue.xBeginDraw());
    this.m_drawPos.SetY(this.m_boardPos.GetY() * cellDistance + ConstValue.yBeginDraw());
}

ChessPiece.prototype.ChangeSelectedState = function ()
{
    if (this.m_isSelected == true)
    {
        this.m_isSelected = false;
    }
    else
    {
        this.m_isSelected = true;
    }
}

ChessPiece.prototype.IsSelected = function ()
{
    return this.m_isSelected;
}

ChessPiece.prototype.SetSelectedImage = function (fileDir)
{
    this.m_selectedImage.src = fileDir;
}

ChessPiece.prototype.Draw = function ()
{
    var context = canvas.getContext("2d");
    if (this.m_isSelected == false)
    {  
        context.drawImage(this.m_imageChessPiece, this.m_drawPos.GetX(), this.m_drawPos.GetY());
    }
    else
    {
        context.drawImage(this.m_selectedImage, this.m_drawPos.GetX(), this.m_drawPos.GetY());
    }
}

ChessPiece.prototype.SetRedSide = function (side)
{
    this.m_isRedSide = side;
}

ChessPiece.prototype.IsRedSide = function ()
{
    return this.m_isRedSide;
}